<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>循环渲染数组</title>
</head>
<body>
<div id="app">
    <!-- 将数组使用模板差值进行渲染 -->
    <div>{{ nameList }}</div>
    <br>

    <!--  使用模板差值渲染每个元素  -->
    <div>{{ nameList[0] }}</div>
    <div>{{ nameList[1] }}</div>
    <div>{{ nameList[2] }}</div>
    <div>{{ nameList[3] }}</div>

    <br>

    <div v-for="item in nameList">{{ item }}</div>
    <br>
    <div v-for="(item, index) in nameList">{{index}}、{{ item }}</div>
</div>
<script type="module">
    import {createApp, reactive} from "../../../../../js/vue.esm-browser.js";

    const app = createApp({
        setup() {
            let nameList = reactive(["小白兔", "小黑兔", "小灰兔", "大灰狼"])
            return {
                nameList,
            }
        }
    })
    app.mount("#app")
</script>
</body>
</html>